const config = require("../configs.js");

const generateApiFile = () => {
  return `
    import request from '@/utils/request';

    const baseURL = import.meta.env.VITE_APP_JAVA_BASE_URL as string;
    // const baseURL = 'https://localhost.midea.com:8888/qms/qms-manage-service';

    export class Api {
      // 查询首页列表
      public static getList(data: {}) {
          return request(
              {
                  url: \`\${baseURL}\`,
                  method: 'post',
                  data,
              },
              { codeMessageShow: true },
          );
      }

      // 查询详情
      public static getDetail(data: {}) {
          return request(
              {
                  url: \`\${baseURL}/\`,
                  method: 'post',
                  data,
              },
              { loading: true, codeMessageShow: true },
          );
      }

      // 暂存/提交
      public static save(data: {}) {
          return request(
              {
                  url: \`\${baseURL}/\`,
                  method: 'post',
                  data,
              },
              { loading: true, codeMessageShow: true },
          );
      }

      // 删除
      public static delete(data: {}) {
          return request(
              {
                  url: \`\${baseURL}/\`,
                  method: 'post',
                  data,
              },
              { loading: true, codeMessageShow: true },
          );
      }

      // 导出Excel
      public static exportExcel(data: {}) {
          return request(
              {
                  url: \`\${baseURL}/\`,
                  method: 'post',
                  responseType: 'arraybuffer',
                  data,
              },
              { codeMessageShow: true },
          );
      }
  }
  `;
};

module.exports = {
  generateApiFile,
};
